package com.zking.dao.mapper;

import com.zking.dao.domain.Patient;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;
import org.springframework.stereotype.Repository;
import java.util.List;

/**
 * @author Tanglei
 * @date 2020/8/20 - 14:20
 */
@Repository
public interface PatientMapper {

    @Select("select * from patient")
    List<Patient> queryPatients();

    @Select("select * from patient where id = #{id}")
    Patient queryOnePatient(Integer id);

    @Update("update patient set name = #{name}," +
            "password = #{password}," +
            "sex = #{sex}," +
            "phone = #{phone}," +
            "idcard = #{idcard} where id = #{id}")
    Boolean updatePatient(Patient patient);

    @Select("select COUNT(*) FROM patient")
    public int queryPatientCount();
}
